//package com.project.controller.web;
//
//import com.project.entity.MagFacultyInfo;
//import com.project.entity.OrgInfo;
//import com.project.entity.RecruitInfo;
//import com.project.entity.User;
//import com.project.myBeans.ResponseBean;
//import com.project.service.MagFacultyInfoService;
//import com.project.service.OrgInfoService;
//import com.project.service.RecruitInfoService;
//import com.project.service.UserService;
//import com.project.service.base.BaseService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.List;
//
///**
// * Created by hasee on 2017/3/21.
// */
//@Controller
//@RequestMapping("/admin")
//public class AdminController extends BaseService {
//    @Autowired
//    MagFacultyInfoService magFacultyInfoService;
//    @Autowired
//    UserService userService;
//    @Autowired
//    RecruitInfoService recruitInfoService;
//    @Autowired
//    OrgInfoService orgInfoService;
//
//
//    @RequestMapping(value = "/findOne/{id}", method = RequestMethod.GET)
//    @ResponseBody
//    public ResponseBean findOne(@PathVariable("id") Integer id){
//        ResponseBean responseBean = new ResponseBean();
//        try{
//            MagFacultyInfo magFacultyInfo = null;
//
//        }catch (Exception e){
//
//        }
//    }
//    @RequestMapping("/admin/showAdmin")
//    public String showAdmin(HttpServletRequest request,Model model)
//    {
//        magFacultyInfo = magFacultyInfoService.findByUserId(Integer.parseInt(request.getParameter("userId")));
//
//        if(magFacultyInfo != null)
//        {
//            model.addAttribute("MagFacultyInfo",magFacultyInfo);
//            return "admin/showAdmin";
//
//        }
//       else
//        {
//
//            return "admin/adminError";
//
//        }
//    }
//
//    @RequestMapping("/admin/showEditAdmin")
//    public String editAdmin(HttpServletRequest request,Model model)
//    {
//        magFacultyInfo = magFacultyInfoService.findByUserId(Integer.parseInt(request.getParameter("userId")));
//        if (magFacultyInfo != null)
//        {
//            return "admin/editAdmin";
//        }
//        else
//        {
//            return "admin/createAdmin";
//        }
//    }
//
//
//    @RequestMapping("/admin/creatAdmin")
//    public String creatAdmin(HttpServletRequest request,Model model)
//    {
//        int userId = Integer.parseInt(request.getParameter("userId"));
//        int schoolId = Integer.parseInt(request.getParameter("schoolId"));
//        int divisionId = Integer.parseInt(request.getParameter("divisionId"));
//        int universityId = Integer.parseInt(request.getParameter("universityId"));
//        String phone = request.getParameter("phone");
//        String qq = request.getParameter("qq");
//        String wechat = request.getParameter("wechat");
//        log.info(userId +  "  " + schoolId + "  " + divisionId+ "  " + universityId+ "  " + phone+ "  " + qq+ "  " + wechat );
//        MagFacultyInfo magFacultyInfo = new MagFacultyInfo();
//        magFacultyInfo.setUserid(userId);
//        magFacultyInfo.setSchoolid(schoolId);
//        magFacultyInfo.setDivisionid(divisionId);
//        magFacultyInfo.setUniversityid(universityId);
//        magFacultyInfo.setPhone(phone);
//        magFacultyInfo.setQq(qq);
//        magFacultyInfo.setWechat(wechat);
//        magFacultyInfoService.creatMagFacultyInfo(magFacultyInfo);
//        User user = userService.findByUserID(userId);
//        model.addAttribute("User",user);
//        return "admin/admin";
//    }
//
//    @RequestMapping("/admin/editAdmin")
//    public String reeditAdmin(HttpServletRequest request,Model model)
//    {
//        int userId = Integer.parseInt(request.getParameter("userId"));
//        int schoolId = Integer.parseInt(request.getParameter("schoolId"));
//        int divisionId = Integer.parseInt(request.getParameter("divisionId"));
//        int universityId = Integer.parseInt(request.getParameter("universityId"));
//        String phone = request.getParameter("phone");
//        String qq = request.getParameter("qq");
//        String wechat = request.getParameter("wechat");
//        log.info(userId +  "  " + schoolId + "  " + divisionId+ "  " + universityId+ "  " + phone+ "  " + qq+ "  " + wechat );
//        MagFacultyInfo magFacultyInfo = new MagFacultyInfo();
//        magFacultyInfo.setUserid(userId);
//        magFacultyInfo.setSchoolid(schoolId);
//        magFacultyInfo.setDivisionid(divisionId);
//        magFacultyInfo.setUniversityid(universityId);
//        magFacultyInfo.setPhone(phone);
//        magFacultyInfo.setQq(qq);
//        magFacultyInfo.setWechat(wechat);
//        magFacultyInfoService.updateByPrimaryKeySelective(magFacultyInfo);
//        User user = userService.findByUserID(userId);
//        model.addAttribute("User",user);
//        return "admin/admin";
//    }
//
//    @RequestMapping("/admin/selectAllInfo")
//    public String selectAllInfo(Model model)
//    {
//        List<RecruitInfo> recruitInfos = recruitInfoService.findAll();
//        model.addAttribute("recruitInfos",recruitInfos);
//        log.info(recruitInfos.get(0).getTitle());
//        return "admin/adminRecruitCheck";
//    }
//
//    @RequestMapping("/admin/adminCheckRecuitInfo")
//    public String adminCheckRecuitInfo(HttpServletRequest request,Model model)
//    {
//        int id =  Integer.parseInt(request.getParameter("id"));
//        RecruitInfo recruitInfo = recruitInfoService.findRecruitInfoById(id);
//        model.addAttribute("recruitInfo",recruitInfo);
//        log.info(recruitInfo);
//        return "admin/recruitInfoCheck";
//    }
//
//    @RequestMapping("/admin/recruitInfoCheck")
//    public String recruitInfoCheck(HttpServletRequest request,Model model)
//    {
//        int id =  Integer.parseInt(request.getParameter("recruitId"));
//        RecruitInfo recruitInfo = recruitInfoService.findRecruitInfoById(id);
//        recruitInfo.setState(Integer.parseInt(request.getParameter("state")));
//        recruitInfo.setAuditsug(request.getParameter("auditsug"));
//        recruitInfoService.modifyRecruitInfoById(recruitInfo);
//        return "admin/adminMain";
//    }
//
//    @RequestMapping("/admin/searchRegistered")
//    @ResponseBody
//    public ResponseBean adminfindALLRegistered(){
//        ResponseBean responseBean = new ResponseBean();
//        List<OrgInfo> OrgInfos;
//        OrgInfos = orgInfoService.findOrgInfoBatch();
//        responseBean.setData(OrgInfos);
//        return responseBean;
//    }
//
//}
